package com.example.qxglxt.dao;

//import javax.transaction.Transactional; 

import com.example.qxglxt.model.Users;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional; 

/**
 * IUsersDao
 */
public interface IUsersDao extends JpaRepository<Users,Integer>,JpaSpecificationExecutor<Users>{

    @Transactional
    @Modifying
    @Query("update Users u set u.IsLockout=:IsLockout where u.LoginName=:LoginName ") 
    int editIslockout(@Param("LoginName") String LoginName, @Param("IsLockout") String IsLockout);//是否锁定
 
    
    @Modifying
    @Query("update Users u set u.PassWord=:PassWord where u.id=:id")  
    int editpwd(@Param("id") Integer id,@Param("PassWord") String PassWord); //重置密码

    @Modifying
    @Query(value = "select * from Users u where u.login_name=?1 and u.pass_word=?2",nativeQuery = true)
    Users login(String LoginName,String PassWord);
    
}